class CustomStack {
private:
    int maxSize;
    int cur=0;
    vector<int> cut;
public:
    CustomStack(int maxSize) {
        this->maxSize=maxSize;
        cut.resize(maxSize);
    }
    
    void push(int x) {
        if(cur<maxSize){
            cut[cur++]=x;
            //cout<<cut[cur-1]<<"%"<<endl;
        }
    }
    
    int pop() {
        int temp=-1;
        if(cur>0){
            temp=cut[cur-1];
            cut[cur-1]=0;
            cur--;
            //cout<<cur<<"#"<<temp<<"$"<<endl;
        }
        return temp;
    }
    
    void increment(int k, int val) {
        if(k<=cur){
            for(int j=0;j<k;j++){
                cut[j]+=val;
            }
        }
        else{
            for(int j=0;j<cur;j++){
                cut[j]+=val;
            }
        }
    }
};